package variabilitysmelldetection.measurement.measures.spl;

import java.util.List;

import variabilitysmelldetection.measurement.measures.Measure;
import variabilitysmelldetection.measurement.measures.component.WeightedMethodsPerClass;
import variabilitysmelldetection.measurement.models.ComponentItem;


public class TotalCyclomaticComplexity extends Measure {

	public TotalCyclomaticComplexity(){
		super("Total Cyclomatic Complexity", "TCyclo");
	}
	
	@Override
	public void measure(List<ComponentItem> classes) {
		int value = 0;
		for (ComponentItem c : classes) {

			Measure measure = c.getMeasure(WeightedMethodsPerClass.class);
			if (measure != null) {
				value += measure.getValue();
			}
		}
		setValue(value);
	}
}
